<template>
  <ul class="switches">
    <li class="switch-item" :class="{'active':switchIndex === index}" v-for="(item,index) in switchArr" :key="index" @click="clickSwitch(index)">
      <span>{{item}}</span>
    </li>
  </ul>
</template>

<script>
  export default {
    name: 'Switches',
    props: {
      switchArr: {
        type: Array,
        default: []
      },
      switchIndex: {
        type: Number,
        default: 0
      }
    },
    methods: {
      clickSwitch(index) {
        this.$emit('clickSwitches', index)
      }
    }
  }

</script>
